/* eslint valid-jsdoc: "off" */

/**
 * @param {Egg.EggAppInfo} appInfo app info
 */
module.exports = appInfo => {
  /**
   * built-in config
   * @type {Egg.EggAppConfig}
   **/
  const config = exports = {};
  const path = require('path');

  // use for cookie sign key, should change to your own and keep security
<<<<<<< HEAD
  config.keys = appInfo.name + '_1627384950486_8234';
=======
  config.keys = appInfo.name + '_1761653640315_7499';
>>>>>>> resume

  // add your middleware config here
  config.middleware = ['jwtAuth'];

<<<<<<< HEAD
  // 数据库配置
  config.sequelize = {
    dialect: 'mysql',
    host: '127.0.0.1',
    port: 3306,
    database: 'job_pulse_db',
    username: 'root', 
    password: '123456', 
    define: {
      timestamps: true,
      freezeTableName: true,
      underscored: true
    }
  };

  // 安全配置
  config.security = {
    csrf: {
      enable: false,
    }
  };

  // CORS配置
  config.cors = {
    origin: '*',
    allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'
  };

  return config;
};
=======
  // Sequelize 配置
  config.sequelize = {
    dialect: 'mysql',
    host: 'localhost',
    port: 3306,
    database: 'job_pulse_db',
    username: 'root',
    password: '123456',
    timezone: '+08:00',
    define: {
      timestamps: true,
      underscored: true,
      freezeTableName: true,
    },
  };

  // CORS 配置（允许前端访问）
  config.cors = {
    origin: '*',
    allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
  };

  // 安全配置（关闭 CSRF）
  config.security = {
    csrf: {
      enable: false,
    },
  };

  // 文件上传配置
  config.multipart = {
    mode: 'file',
    fileSize: '10mb',
    whitelist: ['.jpg', '.jpeg', '.png', '.gif', '.webp', '.pdf'],
    tmpdir: appInfo.baseDir + '/app/public/temp',
  };

  // JWT配置
  config.jwt = {
    secret: 'job-pulse-jwt-secret-key-2024', // 实际项目中应该使用环境变量
    expiresIn: '7d', // token有效期7天
  };

  // 静态资源配置
  config.static = {
    prefix: '/public/',
    dir: appInfo.baseDir + '/app/public',
  };

  // add your user config here
  const userConfig = {
    // myAppName: 'egg',
  };

  return {
    ...config,
    ...userConfig,
  };
};
>>>>>>> resume
